package giteetest.Jdbc.testjdbc;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author SWJ
 * @create 2021-07-05 11:42
 * 连接数据库
 */
public class Test1 {
    static public Connection getConnection() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        //简写省略本机端口号
        String url = "jdbc:mysql:///cbg2011?characterEncoding=utf8";
        Connection conn = DriverManager.getConnection(url, "root", "199881");
        return conn;
    }

}
